﻿using System;
using Furion;
using Microsoft.Extensions.Logging;
using PMP.Core.Extensions;
using SqlSugar;

namespace PMP.Core.Entities;


/// <summary>
/// 系统日志
/// </summary>
[SugarTable("SysExceptionLog")]
public class SysExceptionLog 
{
    /// <summary>
    /// id
    /// </summary>
    [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
    public int Id { get; set; }

    /// <summary>
    /// 记录器类别名称
    /// </summary>
    public string LogName { get; set; } = string.Empty;

    /// <summary>
    /// 日志级别
    /// </summary>
    public LogLevel LogLevel { get; set; }

    /// <summary>
    /// 调用方法
    /// </summary>
    [SugarColumn(Length = 100)]
    public string RequestUrl { get; set; } = string.Empty;

    /// <summary>
    /// 调用方法参数
    /// </summary>
    [SugarColumn(Length = 2000)]
    public string RequestBody { get; set; } = string.Empty;

    /// <summary>
    /// 日志消息
    /// </summary>
    [SugarColumn(Length = 400)]
    public string Message { get; set; } = string.Empty;

    /// <summary>
    /// 异常堆栈信息
    /// </summary>
    [SugarColumn(Length = 4000)]
    public string StackTrace { get; set; } = string.Empty;

    /// <summary>
    ///  操作人Id
    /// </summary>
    public int OperatorId { get; set; } = App.User.GetUserId();
    public string OperatorName { get; set; } = App.User.GetUserName();

    /// <summary>
    /// 日志记录时间
    /// </summary>
    public DateTime LogDateTime { get; set; } = DateTime.Now;

    
}